<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	template="/template/template.xhtml">

	<ui:define name="styleAndScript"></ui:define>
	<ui:define name="center_content">
		<p:breadCrumb>
			<p:menuitem value="首页" url="/faces/index.xhtml" />
			<p:menuitem value="字典管理" url="#" />
		</p:breadCrumb>
		<h:form prependId="false" id="main_form">
			<div class="style1">
				<h:panelGrid columns="6" columnClasses="column1,column2,column1,column2,column1,column2">
					<h:outputText value="编号：" />
					<p:inputText value="#{dictBean.queryMap['code']}" />
					<h:outputText value="名称：" />
					<p:inputText value="#{dictBean.queryMap['name']}" />
					<h:outputText value="类型：" />
					<h:selectOneMenu value="#{dictBean.queryMap['type']}" 
						styleClass="ui-inputfield ui-widget ui-state-default ui-corner-all">
						<f:selectItem itemLabel="#{msgs.select}" itemValue=""/>
						<f:selectItems value="#{dictBean.types}"/>
					</h:selectOneMenu>
		        </h:panelGrid>
		        <div>
		        	<p:commandButton value="#{msgs.btnQuery}" icon="#{comm.queryClass}" 
		        		action="#{dictBean.search}" update=":main_form:dict_data_table" 
		        		disabled="#{!dictBean.permission.query}"/>
		        	<p:commandButton value="#{msgs.btnReset}" icon="#{comm.resetClass}" type="reset"/>
		        </div>
			</div>
	
			<p:contextMenu for="dict_data_table">
				<p:menuitem value="#{msgs.btnQuery}" icon="#{comm.queryClass}" 
					 oncomplete="dict_edit_var.show();" update=":dict_edit_dialog"
					 disabled="#{!dictBean.permission.query}">
					<f:setPropertyActionListener target="#{dictBean.model}" value="#{comm.m_q}" />
					<f:setPropertyActionListener target="#{dictBean.summary}" value="查询字典信息：" />
				</p:menuitem>
				<p:menuitem value="#{msgs.btnEdit}" icon="#{comm.editClass}"
					oncomplete="dict_edit_var.show();" update=":dict_edit_dialog"
					disabled="#{!dictBean.permission.modify}">
					<f:setPropertyActionListener target="#{dictBean.model}" value="#{comm.m_m}" />
					<f:setPropertyActionListener target="#{dictBean.summary}" value="编辑字典信息：" />
				</p:menuitem>
			</p:contextMenu>
	
			<p:dataTable id="dict_data_table" value="#{dictBean.lazyData}"
				var="data" paginator="true" rows="10" paginatorPosition="bottom"
				paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
				currentPageReportTemplate="{currentPage}/{totalPages}"
				selectionMode="single" selection="#{dictBean.instance}"
				emptyMessage="#{msgs.emptyResult}">
				<f:facet name="header">字典信息列表
					<div style="text-align: right; position: relative; margin: -13px -5px 0px 0px; vertical-align: middle">
						<p:commandButton value="#{msgs.btnNew}" icon="#{comm.newClass}"
							actionListener="#{dictBean.initAddDict}" update=":dict_edit_dialog"
							oncomplete="dict_edit_var.show();" disabled="#{!dictBean.permission.add}">
							<f:setPropertyActionListener target="#{dictBean.model}" value="#{comm.m_a}"/>
							<f:setPropertyActionListener target="#{dictBean.summary}" value="添加字典信息：" />
						</p:commandButton>
					</div>
				</f:facet>
	
				<p:column headerText="编号" style="width: 20%;"><h:outputText title="#{data.id}" value="#{data.code}"/></p:column>
				<p:column headerText="名称">#{data.name}</p:column>
				<p:column headerText="值" style="width: 15%;">#{data.value}</p:column>
				<p:column headerText="类型" style="width: 5%;">#{data.type}</p:column>
				<p:column headerText="#{msgs.sys}" style="width: 5%;">
					#{data.sysId == 1 ? msgs.sys_y : msgs.sys_n}
				</p:column>
				<p:column headerText="#{msgs.valid}" style="width: 5%;">
					#{data.status == 1 ? msgs.valid_y : msgs.valid_n}
				</p:column>
				<p:column headerText="资源备注" style="width: 15%;">#{data.note}</p:column>
				<p:column headerText="操作" style="width: 7%;">
					<p:commandButton title="#{msgs.btnQuery}" icon="#{comm.queryClass}" 
						 oncomplete="dict_edit_var.show();" update=":dict_edit_dialog" 
						 disabled="#{!dictBean.permission.query}">
						<f:setPropertyActionListener target="#{dictBean.model}" value="#{comm.m_q}" />
						<f:setPropertyActionListener target="#{dictBean.summary}" value="查询字典信息：" />
						<f:setPropertyActionListener target="#{dictBean.instance}" value="#{data}"/>
					</p:commandButton>
					
					<p:commandButton title="#{msgs.btnEdit}" icon="#{comm.editClass}"
						oncomplete="dict_edit_var.show();" update=":dict_edit_dialog"
						disabled="#{!dictBean.permission.modify}">
						<f:setPropertyActionListener target="#{dictBean.model}" value="#{comm.m_m}" />
						<f:setPropertyActionListener target="#{dictBean.summary}" value="编辑字典信息：" />
						<f:setPropertyActionListener target="#{dictBean.instance}" value="#{data}" />
					</p:commandButton>
				</p:column>
			</p:dataTable>
		</h:form>
	</ui:define>
	
	<ui:define name="edit_content">
		<ui:include src="/faces/common/dict/dict_edit.xhtml" />
	</ui:define>
</ui:composition>